using System;
using System.Collections.Generic;
using System.Text;
using System.Linq;
using FriendsNearby.Services.Entities;

namespace FriendsNearby.Services.Tests.Mocks
{
    public class MockUsersService : IUsersService
    {
		public Dictionary<string, UserPreference> Preferences = new Dictionary<string,UserPreference>();

        #region IUsersService Members

        public void RegisterFacebookUser(string userId, string sessionKey)
        {
        }

        public void UnregisterFacebookUser(string userId)
        {
			Preferences.Remove(userId);
        }

        public UserPreference GetUserPreferences(string userId)
        {
			UserPreference p;
			Preferences.TryGetValue(userId, out p);

			return p;
        }

        public void SetUserPreferences(UserPreference preferences)
        {
			Preferences[preferences.FacebookUserId] = preferences;
        }

		public string GetFacebookUserIdFromTwitter(string screenName)
		{
			var query = from pref in Preferences
						where pref.Value.TwitterScreenName == screenName
						select pref.Value.FacebookUserId;

			return query.FirstOrDefault();
		}

        public string GetInternalUserIDFromFacebookUserID(string facebookUserID)
        {
            throw new NotImplementedException();
        }

        public string GetFacebookUserIDFromInternalUserID(string internalUserID)
        {
            throw new NotImplementedException();
        }

        public void EnsureUserRegistryExists(string userID, string sessionKey)
        {
            throw new NotImplementedException();
        }

        #endregion
    }
}
